<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>商户测试页面</title>
<script type="text/javascript" src="../jquery/jquery.min.js"></script>
<style type="text/css"> 
body,table{
	font-size:15px;
	width:auto;
}
td{
	height:30px;
}
</style>
<script>
	$(function(){
		/*$.ajax({
            url: "http://127.0.0.1:8080/bank/psbcPayResult.json?appId=6103_web&sig=xxx",
            type: 'GET',
            dataType: 'json',
            timeout: 1000,
            cache: false,
            success: succFunction //成功执行方法
        })
        function succFunction(tt) {
            var json = eval(tt); //数组
            alert(json.TermSsn); // 订单号
            alert(json.TranAmt); // 交易金额
            alert(json.dateStr); // 交易日期
            alert(json.RespCode); // 交易返回码
        }*/
		var url = window.location.href;
        url = url.split("?")[1];
        var array = new Array();
        array = url.split("&");
        for(var i=0;i<array.length;i++) {
        	var key = array[i].split("=")[0];
        	var val = array[i].split("=")[1];
        	if(key == "code") {
        		if(val == "301") {
        			$("#idTitle").html("");
        			$("#tr1").hide();
        			$("#tr2").hide();
        			$("#tr3").hide();
        			$("#idTitle").html("支付失败");
        		}
        	} else if(key == "RespCode") {
    			$("#idTitle").html("");
        		if(val == "00000000") {
        			$("#idTitle").html("支付成功");
        		} else {
        			$("#tr1").hide();
        			$("#tr2").hide();
        			$("#tr3").hide();
        			$("#idTitle").html("支付失败");
        		}
        	} else if(key == "TermSsn") {
    			$("#TermSsn").html(val);
        	} else if(key == "MercDtTm") {
        		if(val == null || val == "") {
        			$("#MercDtTm").html("");
        		} else {
					var year = val.substring(0, 4);
					var month = val.substring(4, 6);
					var day = val.substring(6, 8);
					var hh = val.substring(8, 10);
					var mm = val.substring(10, 12);
					var ss = val.substring(12, 14);
    			$("#MercDtTm").html(year+"-"+month+"-"+day+" "+hh+":"+mm+":"+ss);
        		}
        	} else if(key == "TranAmt") {
        		if(val == null || val == "") {
        			$("#TranAmt").html("");
        		} else {
        			$("#TranAmt").html(val+"元");
        		}
        	}
        }
	});
</script>
</head>
<body>
	<table align="center">
		<tr>
			<td colspan="3" id="idTitle" align="center" style="font-size:20px;"></td>
		</tr>
		<tr id="tr1">
			<td>订 单 号：</td>
			<td id="TermSsn"></td>
		</tr>
		<tr id="tr2">
			<td>交易时间：</td>
			<td id="MercDtTm"></td>
		</tr>
		<tr id="tr3">
			<td>交易金额：</td>
			<td id="TranAmt"></td>
		</tr>
	</table>
</body>
</html>
